x86/np2m: simplify nestedhvm_hap_nested_page_fault()
authorSergey Dyasli <sergey.dyasli@citrix.com>
Tue, 3 Oct 2017 15:20:59 +0000 (16:20 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 6 Oct 2017 12:36:43 +0000 (13:36 +0100)
commitec832dddc4c5a8794d6d89448da2b14186da1baf
tree9f16a28100ed426fbf9c56fee3910f719e04ce1c
parentcd579578aac496898a260ddcfac5cf51f3518dd4
x86/np2m: simplify nestedhvm_hap_nested_page_fault()

There is a possibility for nested_p2m to became stale between
nestedhvm_hap_nested_page_fault() and nestedhap_fix_p2m().  At the moment
this is handled by detecting such a race inside nestedhap_fix_p2m() and
special-casing it.

Instead, introduce p2m_get_nestedp2m_locked(), which will returned a
still-locked p2m.  This allows us to call nestedhap_fix_p2m() with the
lock held and remove the code detecting the special-case.

Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jun Nakajima <jun.nakajima@intel.com>
xen/arch/x86/mm/hap/nested_hap.c
xen/arch/x86/mm/p2m.c
xen/include/asm-x86/p2m.h